/**
 * 
 */
package ac.svn.accesscontrol.io;

import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;

/**
 * @author Enigmanic
 *
 */
public class FileReader {

	private Map<Integer,String> fileContent;
	public FileReader()
	{
		fileContent = new HashMap<Integer, String>();
	}

	public boolean readFile(String filePath)
	{
		boolean readStatus = false;
		try
		{
			// Open the file that is the first 
			// command line parameter
			FileInputStream fstream = new FileInputStream(filePath);
			// Get the object of DataInputStream
			DataInputStream in = new DataInputStream(fstream);
			BufferedReader br = new BufferedReader(new InputStreamReader(in));
			String strLine;
			//Read File Line By Line
			int count = 0;
			while ((strLine = br.readLine()) != null)   {
				// Print the content on the console
				//System.out.println (strLine);
				count += 100;
				fileContent.put(count, strLine);
			}
			readStatus = true;
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return readStatus; 
	}
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		FileReader fileReader = new FileReader();
		if(fileReader.readFile("D:\\MyDev\\TestCenter\\authz.txt"))
		{
			System.err.println(fileReader.getFileContent().keySet());
		}
	}

	public Map<Integer, String> getFileContent() {
		return fileContent;
	}

	public void setFileContent(Map<Integer, String> fileContent) {
		this.fileContent = fileContent;
	}

}
